﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Security;
using System.Data;
using System.Configuration;

namespace DonationTracker
{
    public partial class ViewDonations : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                if (User.IsInRole("Administrator"))
                {
                    ddlCharities.Visible = true;
                }
                else
                {
                    string userID = Membership.GetUser().ProviderUserKey.ToString();
                    dsViewDonations.SelectParameters["userID"] =
                        new Parameter("userID", DbType.Guid, userID);
                }
            }
        }

        protected void ddlCharities_SelectedIndexChanged(object sender, EventArgs e)
        {
            dsViewDonations.SelectParameters["dropdown"] =
                new Parameter("dropdown", DbType.Int32, ddlCharities.SelectedValue);
        }
    }
}